<template>
  <view class="page-container">
    <!-- 顶部黄色背景 -->
    <view class="header-bg"></view>

    <view class="content-wrapper">
      <!-- 搜索框 -->
      <view class="search-bar">
        <uv-search
          placeholder="请输入达人姓名"
          v-model="keyword"
          :showAction="false"
          shape="round"
          bgColor="#fff"
        ></uv-search>
      </view>

      <!-- 达人列表 -->
      <companion-list class="companion-list-component"></companion-list>
    </view>

    <!-- 底部操作栏 -->
    <view class="bottom-bar">
      <button class="back-button" @click="navigateBack">返回首页</button>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const keyword = ref('');

const navigateBack = () => {
  uni.navigateBack();
};
</script>

<style lang="scss" scoped>
.page-container {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.header-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  background-color: #ffde58;
  z-index: 1;
}

.content-wrapper {
  position: relative;
  padding: 0 15px;
  z-index: 2;
  height: 100%;
  padding-bottom: 80px; /* 为底部按钮留出空间 */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.search-bar {
  padding-top: 40px; /* 状态栏高度 */
  margin-bottom: 15px;
}

.companion-list-component {
  flex: 1;
  overflow-y: auto;
}

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background-color: #fff;
  padding: 15px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

.back-button {
  background-color: #ffde58;
  color: #333;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 25px;
  height: 50px;
  line-height: 50px;
  text-align: center;
  margin: 0;
}
</style>
